﻿#region Using declarations
using System;
using System.ComponentModel;
using System.Drawing;
using System.Globalization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Indicator;
using NinjaTrader.Strategy;
#endregion

// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
    partial class Strategy
    {
        ///Returns the Nth highest value of the listed inputs.
        public double NthMaxList(int index, double[] list)
        {

            for (int x = 0; x < list.Length; x++)
            {
                for (int i = 0; i < list.Length - 1; i++)
                {
                    if (list[i] > list[i + 1])
                    {
                        double temp = list[i];
                        list[i] = list[i + 1];
                        list[i + 1] = temp;
                    }
                }
            }
            return list[list.Length - index];
        }

    }
}
